<template>
	<view class="page-body login_container">
		<view class="login">
			<view style="text-align: center;margin-top: 30upx;">
				<text class="unifont logo">&#xe6d0;</text>
			</view>
			<input v-model="submitData.username" type="text" placeholder="填写用户名" />
			<input v-model="submitData.password" type="password" placeholder="填写密码" />
			<button @click="register" type="info">提交</button>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				submitData: {
					username: '',
					password: ''
				}
			};
		},
		methods: {
			register() {
				this.$axios.post('userLogin/register', this.submitData, (p) => {
					console.log(p)
					uni.showToast({
						icon:'success',
						title: p.data.result,
						duration: 2000
					});
					setTimeout(()=>{
						if(p.data.result=='该账号已注册!')
						{
							
							this.submitData.username='';
							this.submitData.password='';
						}
						else{
							uni.navigateTo({
								url:'login?info='+JSON.stringify(this.submitData)
							})
						}
					},2000)
				})
			}
		}
	}
</script>

<style>
	.login_container {
		display: flex;
		justify-content: center;
		width: 100%;
	}

	button,
	input {
		margin-top: 30upx;
		margin-bottom: 30upx;
	}

	input {
		height: 80upx;
		border: 1px solid #F0F0F0;
		border-radius: 8upx;
		padding-left: 20upx;
	}

	.login {
		width: 90%;
	}

	.login image {
		width: 90px;
		margin: 30px auto 40px;
		display: block;
		height: 90px;
		border: 1px solid #F0F0F0;
		border-radius: 100%;
	}

	.flexAround {
		margin-top: 40upx;
	}

	.flexAround text {
		color: #108EE9;
	}

	.logo {
		font-size: 180upx;
		border: 1px solid #F0F0F0;
		padding: 20upx;
		border-radius: 100%;
		color: #108EE9;
	}
</style>
